package com.qianguo.sender.usercenter;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.ImageView;

import com.eva.androidlibrary.widget.mdedittext.MaterialEditText;
import com.qianguo.sender.R;
import com.qianguo.sender.base.BaseChooseImageActivity;

import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;

/**
 * 实名认证页面
 *
 * @author eva
 * @date 16/5/16
 */
@EActivity(R.layout.activity_sender_certification)
public class CertificationActivity extends BaseChooseImageActivity implements View.OnClickListener {

    @ViewById(R.id.sender_certification_real_name_edit_text)
    MaterialEditText mEdtRealName;

    @ViewById(R.id.sender_certification_id_card_edit_text)
    MaterialEditText mEdtIDCard;

    @ViewById(R.id.sender_certification_id_card_photo_sample_iv)
    ImageView mImgIDCardSample;

    @ViewById(R.id.sender_certification_id_card_photo_iv)
    ImageView mImgIDCard;

    @ViewById(R.id.sender_certification_health_photo_sample_iv)
    ImageView mImgHealthSample;

    @ViewById(R.id.sender_certification_health_photo_iv)
    ImageView mImgHealth;

    @ViewById(R.id.sender_certification_avatar_photo_sample_iv)
    ImageView mImgAvatarSample;

    @ViewById(R.id.sender_certification_avatar_photo_iv)
    ImageView mImgAvatar;

    public static void jumpToCertification(Context context) {
        context.startActivity(new Intent(context, CertificationActivity_.class));
    }
    
    @Click(R.id.sender_certification_verify_button)
    void clickVerify() {
        // TODO: 16/5/16 提交验证
        CertificationResultActivity.jumpToCertificationResult(this);
        this.finish();
    }

    @Override
    protected String getToolbarTitle() {
        return getString(R.string.sender_certification_title);
    }

    @Override
    protected void initializeUI() {
        mImgIDCard.setOnClickListener(this);
        mImgAvatar.setOnClickListener(this);
        mImgHealth.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.sender_certification_id_card_photo_iv:
            case R.id.sender_certification_health_photo_iv:
            case R.id.sender_certification_avatar_photo_iv:
                final ImageView imageView = (ImageView) findViewById(v.getId());
                showPickerDialog(new PicPickerCallback() {
                    @Override
                    public void afterPick(String filePath) {
                        mImageLoader.loadImage(CertificationActivity.this, imageView, filePath);
                    }
                });
                break;
        }

    }
}
